package com.geeguo.ebuilder.operation.controller.system.permission;

import com.geeguo.ebuilder.core.common.action.ActionResult;
import com.geeguo.ebuilder.core.security.annotation.RequiresLogin;
import com.geeguo.ebuilder.operation.base.core.dictionary.ModuleTypeEnum;
import com.geeguo.ebuilder.operation.base.security.model.LoginUser;
import com.geeguo.ebuilder.operation.base.security.utils.AuthUtils;
import com.geeguo.ebuilder.operation.business.system.permission.model.WebMenuVO;
import com.geeguo.ebuilder.operation.business.system.permission.service.PermissionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Set;

@Tag(name = "权限")
@RestController
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @Operation(summary = "获取用户Web端菜单")
    @GetMapping("/system/permission/listWebMenu")
    @RequiresLogin
    public ActionResult<List<WebMenuVO>> listWebMenu() {
        LoginUser currentUser = AuthUtils.getLoginUser();
        List<WebMenuVO> menuList = permissionService.listWebMenuByUser(currentUser);
        return ActionResult.success(menuList);
    }
}